package com.activity;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.widget.DrawerLayout;
import android.view.Gravity;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.util.R;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by marlon on 2016-04-20.
 */
public class CommonToolBarActivity extends Activity {
    @Bind(R.id.dl_right)
    DrawerLayout dl;
    @Bind(R.id.lv_right_menu)
    ListView lvLeftMenu;
    private String[] lvs = {"List Item 01", "List Item 02", "List Item 03", "List Item 04"};
    private ArrayAdapter arrayAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_common_toolbar);
        ButterKnife.bind(this);
        initData();
    }

    private void initData() {
        dl.setScrimColor(Color.TRANSPARENT);//设置阴影为透明颜色
        arrayAdapter = new ArrayAdapter(CommonToolBarActivity.this, android.R.layout.simple_dropdown_item_1line, lvs);
        lvLeftMenu.setAdapter(arrayAdapter); //gitTest

    }

    @OnClick(R.id.iv_menu_commonToolBar)
    public void onMenuClick() {
        if (dl.isDrawerOpen(Gravity.RIGHT)) {
            dl.closeDrawer(Gravity.RIGHT);
        } else {
            dl.openDrawer(Gravity.RIGHT);
        }
    }
}
